<?php

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

namespace datos;

/**
 * Description of ProveedorDao
 *
 * @author Jorge
 */
class ProveedorDao {
     //put your code here
    private $conexion;
    function __construct($conexion) {
        $this->conexion = $conexion;
    }

    
    public function getConexion() {
        return $this->conexion;
    }
    
    public function setConexion($conexion) {
        $this->conexion = $conexion;
    }
    
    public function listProveedores(){
        try{
            $sql = "SELECT cod_prov, 
                       nombre, 
                       rut, 
                       direccion, 
                       pais, 
                       telefono, 
                       fax, 
                       mail, 
                       contacto, 
                       estado
                    FROM proveedor";
            $consulta = $this->conexion->prepare($sql);
            $consulta->execute();
        return $consulta->fetchAll();
        } catch (Exception $ex) {
            throw $ex;
        }
       
    }
}
